[LINUX] gnttab: Add basic DMA tracking
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 30 May 2007 09:46:13 +0000 (10:46 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 30 May 2007 09:46:13 +0000 (10:46 +0100)
commit403542f9101ebfcb45a881d6be9e8543059e409f
treed23591b6947741fcf445f550d5b1d8fc3ddb68b8
parent38d075a82c6ebbe0ae4a3c185f94164aecdc9ba3
[LINUX] gnttab: Add basic DMA tracking

This patch adds basic tracking of outstanding DMA requests on
grant table entries marked as PageForeign.

When a PageForeign struct page is about to be mapped for DMA,
we set its map count to 1 (or zero in actual value).  This is
then checked for when we need to free a grant table entry early
to ensure that we don't free an entry that's currently used for
DMA.

So any entry that has been marked for DMA will not be freed early.

If the unmapping API had a struct page (which exists for the sg
case) then we could do this properly.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c
linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c
linux-2.6-xen-sparse/drivers/xen/core/gnttab.c
linux-2.6-xen-sparse/include/xen/gnttab.h